package com.example.index.tools.glide

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
import com.cat.annotation.Index
import com.example.index.R
import kotlinx.android.synthetic.main.activity_glide_load_image_debug.*

@Index(
    keywords = "Glide",
    link = "http://blog.leanote.com/post/yangtianrui95@gmail.com/Androd-Glide%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90"
)
class GlideLoadImageDebugActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_glide_load_image_debug)
    }

    fun startLoadImage(view: View) {

        val notCacheRequestOpt =
            RequestOptions
                .diskCacheStrategyOf(DiskCacheStrategy.NONE)
                .skipMemoryCache(true)

        Glide.with(this)
            .load("https://github.com/bumptech/glide/raw/master/static/glide_logo.png")
            .apply(notCacheRequestOpt)
            .into(glide_image)
    }
}
